{include header}<div id="primary" class="content-area">
  <div id="content" class="site-content" role="main">
    <article id="post-4" class="post-4 post type-post status-publish format-standard hentry category-uncategorized">
      <header class="entry-header">
        <h1 class="entry-title">
          {$thread_data.title}
        </h1>
      </header>
      <!-- .entry-header -->
      <div class="entry-content editor-style">
        <p>
          {$post_data.content}
        </p>
      </div>
      <!-- .entry-content -->
      <footer class="entry-meta">
          发布在
          <a href="{#WWW}/forum/{$v.fid}.html" rel="category tag">{$forum[$thread_data['fid']]['name']}</a>
          <span class="edit-link"> 于
              <a href="#" title="上午1:17" rel="bookmark">
                  <time class="entry-date" datetime="2016-02-05T01:17:39+00:00"><?php echo humandate($thread_data['atime']); ?></time>
              </a>
          </span>
          <span class="edit-link"> 作者
              <span class="author vcard">
                  <a class="url fn n" href="#" >{$thread_data.user}</a>
              </span>
          </span>
          <span class="edit-link">
              {$thread_data.posts} 个评论
          </span>
          <span class="edit-link">
              <a class="post-edit-link" href="{#WWW}/post/edit/id/{$post_data.id}.html">编辑</a>
          </span>
      </footer>
      <!-- .entry-meta -->
    </article>
    <!-- #post -->

    <!-- .navigation -->
    <div id="comments" class="comments-area">
        <ol class="comment-list">
        {foreach $PostList as $v}
          <li id="comment-6" class="comment byuser comment-author-admin bypostauthor odd alt depth-2">
            <article id="div-comment-6" class="comment-body">
              <footer class="comment-meta">
                <div class="comment-author vcard">
                  <img alt="" src="{#WWW}/public/images/user.gif" class="avatar avatar-40 photo" height="40" width="40">
                  <b class="fn">
                    {$v.user}
                  </b>
                  <span class="says">
                    说道：
                  </span>
                </div>
                <!-- .comment-author -->
                <div class="comment-metadata">
                  <a href="#">
                    <time datetime="2016-02-10T15:33:34+00:00">
                      {$v.atime_str}
                    </time>
                  </a>
                  <span class="edit-link">
                    <a class="comment-edit-link" href="{#WWW}/post/edit/id/{$v.id}.html">
                      编辑
                    </a>
                  </span>
                </div>
                <!-- .comment-metadata -->
              </footer>
              <!-- .comment-meta -->
              <div class="comment-content">
                <p>
                  {$v.content}
                </p>
              </div>
              <!-- .comment-content -->
              <div class="reply">
                <a rel="nofollow" onclick="editor.setValue(editor.getValue()+'@{$v.user}');$('.c-left').scrollTop( $('.c-left')[0].scrollHeight );" class="comment-reply-link">
                  回复
                </a>
              </div>
            </article>
            <!-- .comment-body -->
          </li>
          {/foreach}
          <!-- #comment-## -->
        </ol>
        <nav class="navigation paging-navigation" role="navigation">
			<div class="nav-links">
				{if $pageid!=1}
				<div class="nav-previous"><a href="{#WWW}/thread/{$thread_data.id}.html?pageid={$pageid-1}"><span class="meta-nav">←</span> 上一页</a></div>
				{/if}
				{if $pageid!=$page_count}
				<div class="nav-next"><a href="{#WWW}/thread/{$thread_data.id}.html?pageid={$pageid+1}">下一页 <span class="meta-nav">→</span></a></div>
				{/if}
			</div>

		</nav>


      <div id="respond" class="comment-respond">
        <h3 id="reply-title" class="comment-reply-title">
          发表评论
        </h3>
        <link href="{#WWW}/public/css/simditor.css" type="text/css" rel="stylesheet">
        <style>
        .simditor .simditor-toolbar > ul > li > .toolbar-item {
            display: table-cell;
            width: 40px;
            height: 40px;
            outline: none;
            color: #333333;
            font-size: 15px;
            line-height: 40px;
            vertical-align: middle;
            text-align: center;
            text-decoration: none;
        }
        </style>
        {if IS_LOGIN}
        <textarea id="editor" autofocus></textarea>
        <button style="margin-top:10px" type="submit" id="post" class="btn btn-primary">发表评论</button>
        <script src="/public/js/edit.min.js"></script>


        <script>

            $(function(){
                $("#post").click(function(){
                    var forum = $("#forum").val();
                    $.ajax({
                     url: '/post/post.html',
                     type:"POST",
                     cache: false,
                     data:{id:{$thread_data.id},content:editor.textarea.val()},
                     dataType: 'json'
                 }).then(function(e) {
                     if(!e.error)
                        alert(e.info);
                    else
                        window.location.reload();

                   }, function() {
                     alert('请尝试重新提交');
                   });
                })
            })
        </script>

        {else}

        {/if}

      </div>
      <!-- #respond -->
    </div>
    <!-- #comments -->
  </div>
  <!-- #content -->
</div>
{include menu}
{include footer}
